﻿using DevExpress.XtraGrid.Demos.util;
using DXApplicationTangche.DTO;
using mendian;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DXApplicationTangche.UC.订单.service
{
    public class 在制品Service
    {
        public List<DTO在制品> DTO在制品s = new List<DTO在制品>();
        public 在制品Service()
        {
            this.DTO在制品s =
                FunctionHelper.JsonDeserialization<List<DTO在制品>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/project/getWIPCurrentStatus"
                        )
                    );
            this.数据清洗();
        }
        private void 数据清洗()
        {
            foreach (DTO在制品 item in this.DTO在制品s) 
            {
                try { item.styleSizeCd = item.styleSizeCd.Replace("IGS_GROUP_SIZE-", "").Replace("EGS_GROUP_SIZE-", ""); } catch { }
                try { item.orderDate = Convert.ToDateTime(item.orderDate.ToString("yyyy-MM-dd")); } catch { }
                try { item.startTimePlanned = Convert.ToDateTime(item.startTimePlanned.ToString("yyyy-MM-dd")); } catch { }
                try { item.actualFinishDate = Convert.ToDateTime(item.actualFinishDate.ToString("yyyy-MM-dd")); } catch { }
                if (item.styleCategoryCd.Equals(Const款式类别.Shirt_Man))
                {
                    item.styleCategoryCd = "男衬衫";
                }
                else if (item.styleCategoryCd.Equals(Const款式类别.Shirt_Lady))
                {
                    item.styleCategoryCd = "女衬衫";
                }
                else if (item.styleCategoryCd.Equals(Const款式类别.Suit_majia))
                {
                    item.styleCategoryCd = "西服马甲";
                }
                else if (item.styleCategoryCd.Equals(Const款式类别.Pants_Lady))
                {
                    item.styleCategoryCd = "女裤子";
                }
                else if (item.styleCategoryCd.Equals(Const款式类别.Skirt_Lady))
                {
                    item.styleCategoryCd = "半身裙";
                }
                else if (item.styleCategoryCd.Equals(Const款式类别.Dress_Lady))
                {
                    item.styleCategoryCd = "连衣裙";
                }
            }
        }

    }
    public class Const款式类别
    {
        public const String Shirt_Man = "STYLE_CATEGORY-Shirt_Man";//  男衬衫
        public const String Shirt_Lady = "STYLE_CATEGORY-Shirt_Lady";//  女衬衫
        public const String Suit_majia = "STYLE_CATEGORY-Suit_majia";//  西服马甲
        public const String Pants_Lady = "STYLE_CATEGORY-Pants_Lady";//  女裤子
        public const String Skirt_Lady = "STYLE_CATEGORY-Skirt_Lady";//  半身裙
        public const String Dress_Lady = "STYLE_CATEGORY-Dress_Lady";//  连衣裙
    }
    public class DTO在制品
    {
        public String activityDescription { get; set; }
        public DateTime actualFinishDate { get; set; }
        public String batchNo { get; set; }
        public Double batchQuantity { get; set; }
        public String code { get; set; }
        public String content { get; set; }
        public Double costPlusFixedFee { get; set; }
        public String customerId { get; set; }
        public String customerName { get; set; }
        public Boolean done { get; set; }
        public Double duration { get; set; }
        public String id { get; set; }
        public Double index { get; set; }
        public String materialCode { get; set; }
        public String materialNameCn { get; set; }
        public String mobile { get; set; }
        public DateTime orderDate { get; set; }
        public String orderId { get; set; }
        public String orderNo { get; set; }
        public String parentId { get; set; }
        public String refStyleId { get; set; }
        public String responsor { get; set; }
        public String responsorId { get; set; }
        public String shopId { get; set; }
        public String shopName { get; set; }
        public DateTime startTimePlanned { get; set; }
        public String styleCategoryCd { get; set; }
        public String styleNameCn { get; set; }
        public String styleSizeCd { get; set; }
        public String wbsItemId { get; set; }
        public String wbsTemplateId { get; set; }
        public Boolean urgentFlg { get; set; }//是否加急
        public DTO在制品()
        {

        }
    }
}
